const express = require('express');
const router = express.Router();
const { protect } = require('../middleware/auth');
const blogController = require('../controllers/blogController');

// 博客类型列表路由
router.get('/types/list', protect, blogController.getBlogTypes);
// 新增博客类型路由
router.post('/types/add', protect, blogController.addBlogType);
// 编辑博客类型路由
router.post('/types/edit', protect, blogController.editBlogType);
// 删除博客类型路由
router.post('/types/del', protect, blogController.delBlogType);

// 新增/编辑博客路由
router.post('/save', protect, blogController.saveBlog);
// 新增博客路由
router.post('/add', protect, blogController.addBlog);

// 博客列表路由
router.post('/list', protect, blogController.getBlogs);

// 删除博客路由
router.post('/del', protect, blogController.deleteBlog);

module.exports = router;